<2> 2/14/95 TMH changed kReadBlockSize to kReadEnclosureBlockSize
To Do:
*/
#ifndef __TAOCEEnclosure__
#define __TAOCEEnclosure__
#ifndef __OCE__
#include "OCE.h"
#endif
#ifndef __OCEMESSAGING__
#include "OCEMessaging.h"
#endif
#ifndef __OCEMAIL__
#include "OCEMail.h"
#endif
#ifndef __FILES__
#include "Files.h"
#endif
#ifndef __MEMORY__
#include "Memory.h"
#endif
// #ifndef __TAOCEEncList__
// #include "AOCEEncList.h"
// #endif
class TAOCEEncList;
class CEnclosFileSummaryList;
class CEnclosFileSummary;
class CFolder;
enum {
kNoSuchDescriptor,
kDataForkDescriptor,
kResourceForkDescriptor,
kRealNameDescriptor,
kCommentDescriptor,
kBWIconDescriptor,
kColorIconDescriptor,
kUndeclaredDescriptor,
kFileDatesInfoDescriptor,
kFinderInfoDescriptor,
kMacFileInfoDescriptor
};
struct EntryDescriptor {
unsigned long entryID;
unsigned long entryOffset;
unsigned long entryLength;
};
#define kReadEnclosureBlockSize 1024
//------------------------------------------
// TAOCEEnclosure
//------------------------------------------
class TAOCEEnclosure {
public:
TAOCEEnclosure();
~TAOCEEnclosure();
void IAOCEEnclosure(MailMsgRef myMsgRef);
OSErr GetEnclosureBuffer();
OSErr TraverseFile(); // Takes you to the end of the current file. The next buffer received from MSAMGetEnclosure is the start of the next enclosed file/folder.
OSErr NextFile(); // goes to the next file index
OSErr TraverseEnclosures(); // Takes you to the end of all enclosures. The next buffer received from MSAMGetEnclosure will start at the beginning of all enclosures again.
Boolean IsFile(); // checks to see if current enclosure is a file (true) or a folder (false)
OSType EnclosureCreator(); // returns the creator for the file
OSType EnclosureType(); // returns the type for the file
StringPtr EnclosurePath(); // returns a string which is the pathname for the enclosure
void RefreshBuffer();
unsigned char EnclByte();
unsigned short EnclWord();
unsigned long EnclLong();
void EnclNBytes(void* theBuff, unsigned long countBytes);
void EnclSkipNBytes(unsigned long countBytes);
void EnclCStr(char* theCString);
void EnclPStr(StringPtr thePString);
void EnclEntryDescrip(EntryDescriptor* theEntry);
void GetFileInfo();
void GetFileDescriptors();
void GoToFileIndex(unsigned long desiredFileIndex);
void GetAllFileParams();
void GetNextFileParams();
void GetEnclosFileSummaryByIndex(unsigned short theIndex, CEnclosFileSummary* returnSummary);
void ResourceForkStart(unsigned long fileIndex);
void DataForkStart(unsigned long fileIndex);
void AllEnclosures(CFolder* theRootDir);
private:
MSAMGetEnclosurePB fGetEnclosurePB;
MailMsgRef fMsgRef;
Boolean fFileStat;
Boolean fEnclosuresStat;
unsigned long fCurrFileOffset;
unsigned long fCurrEnclosuresOffset;
char fEnumBlocksBuffer[kReadEnclosureBlockSize];
unsigned long fBuffOffset; // where we are in the buffer, 0 based
unsigned long fBuffSize; // offset to the last byte of content (logical buffer size).
// for now physical buffEnd is always (fEnumBlocksBuffer+1023)